<template>
  <div class="admin-container">
    <layout :isCollapse="isCollapse" class="layout"></layout>
    <contented
      :isCollapse="isCollapse"
      :class="!isCollapse ? 'contented' : 'active'"
      @changefold="changefold_fat"
    ></contented>
  </div>
</template>

<script>
import layout from "@/views/Admin/Layout/index";
import contented from "@/views/Admin/Content/index";
export default {
  name: "",
  data() {
    return {
      isCollapse: false,
    };
  },
  components: {
    layout,
    contented,
  },
  methods: {
    changefold_fat() {
      this.isCollapse = !this.isCollapse;
    },
  },
  mounted() {
      //防止恶意跳转网页
    if (localStorage.getItem("path")) {
      if (localStorage.getItem("path")=="/admin") {
      } else {
        this.$router.push("/login");
      }
    } else {
      this.$router.push("/login");
    }
  },
};
</script>

<style lang="less" scoped>
.admin-container {
  display: flex;
  .layout {
    background-color: #545c64;
    position: fixed;
    top: 0;
    bottom: 0;
  }
  .contented {
    flex: 1;
    margin-left: 200px;
  }
  .active {
    flex: 1;
    margin-left: 64px;
  }
}
.move-leave-active {
  transition: all 2s linear;
}
</style>
